#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	FILE* pf = fopen("data.txt", "w");
	if (pf == NULL)
	{
		perror("fopen");
		return 1;
	}
	for (int i = 0; i < 10; i++)
	{
		fputs("abcdef\n", pf);
	}
	fclose(pf);
	pf = NULL;

	FILE* pf1 = fopen("data_copy.txt", "w");
	if (pf1 == NULL)
	{
		perror("fopen");
		return 1;
	}
	FILE* pf2 = fopen("data.txt", "r");
	if (pf2 == NULL)
	{
		perror("fopen");
		return 1;
	}
	int ch = 0;
	while ((ch = fgetc(pf2)) != EOF)
	{
		fputc(ch, pf1);
	}
	fclose(pf1);
	pf1 = NULL;
	fclose(pf2);
	pf2 = NULL;
	return 0;
}